#include <iostream>
#include <cmath>

int user();

int encrypt(int num, int *key);

int decode(int num, int key);

int main() {
    using namespace std;
    double x;
    cout << "输入一个 double 值" << endl;
    cin >> x;
    cout << "\'" << x << "\' 这个值的平方根为:" << sqrt(x) << endl;

    cout << "请输入user的ID:";
    int userId = user();
    cout << "ID:" << userId << endl;
    int key;
    int encId = encrypt(userId, &key);
    cout << "加密后:" << encId << endl;
    cout << "解密:" << decode(encId, key) << endl << key << endl;
    cout << "Done!";
    return 0;
}

int decode(int num, int key) {
    num ^= key;
    return num;
}

int encrypt(int num, int *key) {
    *key = num >> num / (num - 50);
    num ^= *key;
    return num;
}

int user() {
    using std::cin;
    int id;
    cin >> id;
    return id;
}